package com.gears_software.sxdc.dccx.data.model;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by chezhenzhen on 2017/11/22.
 */

public class CanUseVouchersModel {

    private String id;
    private Date enddate;
    private BigDecimal discountamount;
    private BigDecimal discountrate;
    private BigDecimal maxdiscountamount;
    private String voucherrange;
    private BigDecimal startwire;
    private String vouchename;
    private String vouchertypeid;
    private BigDecimal amount;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getEnddate() {
        return enddate;
    }

    public void setEnddate(Date enddate) {
        this.enddate = enddate;
    }

    public BigDecimal getDiscountamount() {
        return discountamount;
    }

    public void setDiscountamount(BigDecimal discountamount) {
        this.discountamount = discountamount;
    }

    public BigDecimal getDiscountrate() {
        return discountrate;
    }

    public void setDiscountrate(BigDecimal discountrate) {
        this.discountrate = discountrate;
    }

    public BigDecimal getMaxdiscountamount() {
        return maxdiscountamount;
    }

    public void setMaxdiscountamount(BigDecimal maxdiscountamount) {
        this.maxdiscountamount = maxdiscountamount;
    }

    public String getVoucherrange() {
        return voucherrange;
    }

    public void setVoucherrange(String voucherrange) {
        this.voucherrange = voucherrange;
    }

    public BigDecimal getStartwire() {
        return startwire;
    }

    public void setStartwire(BigDecimal startwire) {
        this.startwire = startwire;
    }

    public String getVouchename() {
        return vouchename;
    }

    public void setVouchename(String vouchename) {
        this.vouchename = vouchename;
    }

    public String getVouchertypeid() {
        return vouchertypeid;
    }

    public void setVouchertypeid(String vouchertypeid) {
        this.vouchertypeid = vouchertypeid;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    @Override
    public String toString() {
        String vouchertype = "";
        if (vouchertypeid.equals("1")) {
            vouchertype = "现金类";
        } else if (vouchertypeid.equals("2")) {
            vouchertype = "折扣类";
        }
        SimpleDateFormat sf = new SimpleDateFormat("MM-dd HH:mm");
        String end = sf.format(enddate);
        String price = String.format("%.2f",Float.parseFloat(amount.toString()));
        return vouchertype + "优惠" + price + "元，截止时间" + end;
    }
}
